"""
# -*- coding: utf-8 -*-
# @Time    : 2023/6/6 8:47
# @Author  : 王摇摆
# @FileName: Learn6.5.3.2.py
# @Software: PyCharm
# @Blog    ：https://blog.csdn.net/weixin_44943389?type=blog
"""
'''
Python中的单继承的仿写
'''


class person:
    name = ''
    age = 0

    __weight = 68

    def __init__(self, n, a, w):
        self.name = n
        self.age = a
        self.__weight = w

    def talk(self):
        print('%s的年龄是 %d 岁，体重是 %d KG.' % (self.name, self.age, self.__weight))


class student(person):
    grade = ''

    def __init__(self, n, a, w, g):
        person.__init__(self, n, a, w)
        self.grade = g

    def talk(self):
        print('%s的年龄是 %d 岁，目前在读 %s 年级。' % (self.name, self.age, self.age))


p = person('wangyaobai', 18, 70)
p.talk()
s = student('wangguowei', 24, 70, '硕士一')
s.talk()
